package com.chenye.scheduled;

import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @Auther:chenye
 * @Data:2018/4/12
 * @Description:
 */
@Component
public class SchedulingService {
    @Scheduled(fixedRate = 5000)
    public void sayHi(){
        System.out.println("hi!!!");
    }

    @Async
    public String testAsync() throws InterruptedException {
        Thread.sleep(30000);
        System.err.println("异步执行");
        return "完成";
    }
}
